﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<title>团体及学校参观申请表</title>
<link rel="stylesheet" type="text/css" media="screen" href="/eform/css/visitform.css" />
<script type="text/javascript" src="/eform/js/visitform.js"></script>
<script type="text/javascript" src="/eform/js/cal2.js"></script>
<script type="text/javascript" src="/eform/js/cal_conf2.js"></script>
<script type="text/javascript" src="/eform/js/gen_validatorv31.js"></script>
<script type="text/javascript" src="/js/lib/prototype.js"></script>
<script type="text/javascript" src="/js/lib/inputmask.js"></script>
</head>
<%
Function IIf(condition,value1,value2)
	If condition Then IIf = value1 Else IIf = value2
End Function
%>
<body onLoad="Xaprb.InputMask.setupElementMasks()">
    <div id="visitform">
        <h2>线上团体及学校参观申请表</h2>
        <form name="visitform" method="post" action="/eform/Submit.asp">
          <input type="hidden" name="Language" value="chi" />
          <table class="visitForm">
            <tr>
              <th>团体(学校)名称</th>
              <td>         
                 <!--#include file="SchoolId.asp"--><br />
                 <input type="text" id="schoolname" name="name" width="100" size="40" value='<% =Request.Cookies("Applicant")("name") %>' />
                 <!--#include file="../schoolid_scr.asp"-->
              </td>
            </tr>
            <tr>
              <th>地址</th>
              <td><textarea rows="3" name="address" cols="40"><% =Request.Cookies("Applicant")("address") %></textarea></td>
            </tr>
            <tr>
              <th>联络人姓名</th>
              <td><input type="text" name="contactPerson" size="40" value='<% =Request.Cookies("Applicant")("contactPerson") %>' /></td>
            </tr>
            <tr>
              <th>联络人电话</th>
              <td><input type="text" name="contactPhone" size="40" value='<% =Request.Cookies("Applicant")("contactPhone") %>' /></td>
            </tr>
            <tr>
              <th>传真机</th>
              <td><input type="text" name="fax" size="40" value='<% =Request.Cookies("Applicant")("fax") %>' /></td>
            </tr>
            <tr>
              <th>电邮地址 (e-mail)</th>
              <td><input type="text" name="email" size="40" value='<% =Request.Cookies("Applicant")("email") %>' /></td>
            </tr>
            <tr>
              <th>参观人数 (一百人以内)</th>
              <td><input type="text" name="visitorsCount" class="input_mask mask_shortnumber" size="10" value='<% =Server.HTMLEncode(Request("visitorsCount")) %>' /></td>
            </tr>
            <tr>
              <th>随行工作人员(老师)数目</th>
              <td><input type="text" name="teachersCount" class="input_mask mask_shortnumber" size="10" value='<% =Server.HTMLEncode(Request("teachersCount")) %>' /></td>
            </tr>
            <tr>
              <th>年龄层(年级)&nbsp;</th>
              <td><input type="text" name="ageClass" size="10" value='<% =Server.HTMLEncode(Request("ageClass")) %>' /></td>
            </tr>
            <tr>
              <th>预计参观日期</th>
              <td><input type="text" name="visitDate" class="input_mask mask_date_us" size="12" value='<% =Server.HTMLEncode(Request("visitDate")) %>' /><a href="javascript:showCal('Calendar')">选择日期</a>(dd/mm/yyyy)</td>
            </tr>
            <tr>
              <th>预计到馆时间</th>
              <td><input type="text" name="arrivalTime" class="input_mask mask_shorttime"  size="12" value='<% =Server.HTMLEncode(Request("arrivalTime")) %>' />(hh:mm)</td>
            </tr>
            <tr>
              <th>预计离馆时间</th>
              <td><input type="text" name="leaveTime" class="input_mask mask_shorttime"  size="12" value='<% =Server.HTMLEncode(Request("leaveTime")) %>' />(hh:mm)</td>
            </tr>
            <tr>
              <th>导赏服务及参观选项</th>
              <td>展览项目编号<br/><input type="text" id="itemcode" name="activityCode" size="35" value='<% =Server.HTMLEncode(Request("activityCode")) %>' /><a href="javascript:openPopup('/eform/chis/ServiceGuide.html','',500,600)">选择编号</a><br/><input type="checkbox" name="firstTime" <% =IIF(Request("firstTime")="ON", "checked", "") %> value="ON">第一次参观博物馆
                </td>
            </tr>
            <tr>
              <th>导赏语言</th>
              <td><input type="checkbox" name="cantonese" <% =IIF(Request.Cookies("Applicant")("cantonese")="ON","checked", "") %>  value="ON" />广东话  
                <input type="checkbox" name="putonghua" <% =IIF(Request.Cookies("Applicant")("putonghua")="ON","checked", "") %> value="ON" />普通话&nbsp;
                <input type="checkbox" name="portuguese" <% =IIF(Request.Cookies("Applicant")("portuguese")="ON","checked", "") %> value="ON" />Português&nbsp;
                <input type="checkbox" name="english" <% =IIF(Request.Cookies("Applicant")("english")="ON","checked","") %> value="ON" />English</td>
            </tr>
            <tr>
              <th>特别需要</th>
              <td><textarea rows="3" name="remarks" cols="40"><% =Server.HTMLEncode(Request("remarks")) %></textarea></td>
            </tr>
            <tr>
              <td class="submit" colspan="2">
	  	        <%
  	  	        if Session("ErrorMsg")<>"" Then
		        %>
    	        <font color='Red'><big><ul><% =Session("ErrorMsg") %></ul></big></font>
		        <%
  		        Session("ErrorMsg")=""
  		        end if
		        %>
                <input type="submit" name="Submit" value="递交确认" />
                <input type="reset" name="Reset" value="重新填写" />
              </td>
            </tr>
          </table>
        </form>
    </div>
<script type="text/javascript">
	var frmvalidator = new Validator("visitform");
	frmvalidator.EnableMsgsTogether();
	frmvalidator.addValidation("name","req","请填写团体(学校)名称");
	frmvalidator.addValidation("address","req","请填写地址");
	frmvalidator.addValidation("contactPerson","req","请填写联络人姓名");
	frmvalidator.addValidation("contactPhone","req","请填写联络人电话");
	frmvalidator.addValidation("contactPhone","numeric","请填写正确的联络人电话");
	frmvalidator.addValidation("email","email","请填写正确的电邮地址");
	frmvalidator.addValidation("visitorsCount","req","请填写参观人数");
	frmvalidator.addValidation("teachersCount","req","请填写随行工作人员数目");
	frmvalidator.addValidation("visitDate","req","请填写参观日期");
	frmvalidator.addValidation("arrivalTime","req","请填写到馆时间");
	frmvalidator.addValidation("leaveTime","req","请填写离馆时间");
	
	var INVALID_VISITORS_DATE = "请选择正确的参观日期";
	var INVALID_ARRIVAL_TIME = "请填写正确的到馆时间";
	var INVALID_LEAVE_TIME = "请填写正确的离馆时间";
	var INVALID_ARRIVAL_GREATER = "离馆时间不可以早过到馆时间";
	
	frmvalidator.setAddnlValidationFunction("doCustomValidation");
	
	function doCustomValidation() {
		var frm = document.forms["visitform"];
		/*if (false == isFutureDate(frm)) {
			alert(INVALID_VISITORS_DATE);
			return false;
		}
		else {*/
		if (false == isValidArrivalTime(frm)) {
			alert(INVALID_ARRIVAL_TIME);
			return false;
		}
		else {
		if (false == isValidLeaveTime(frm)) {
			alert(INVALID_LEAVE_TIME);
			return false;
		}
		else { 
		if (false == isLeaveGreaterThanArrival(frm)) {
			alert(INVALID_ARRIVAL_GREATER );
			return false;
		}
		else {
			return true;
		}
		}
		}
		//}
	}
	
	function isFutureDate(frm) {
		var VisitDate = new Date(frm.visitDate.value);
		var Today = new Date();
		if (VisitDate < Today) {
			return false;
		}
		else {
			return true;
		}
	}
	
	function isValidArrivalTime(frm) {
		var ArrivalTime = frm.arrivalTime.value.split(":");
		var ArrivalHour = parseInt(ArrivalTime[0]);
		var ArrivalMinute = parseInt(ArrivalTime[1]);
		if ((ArrivalHour > 23 ) | (ArrivalMinute > 59)) {
			return false;
		}
		else {
			return true;
		}
	}
	
	function isValidLeaveTime(frm) {
		var LeaveTime = frm.leaveTime.value.split(":");
		var LeaveHour = parseInt(LeaveTime[0]);
		var LeaveMinute = parseInt(LeaveTime[1]);
		if ((LeaveHour > 23 ) | (LeaveMinute > 59)) {
			return false;
		}
		else {
			return true;
		}
	}
	
	function isLeaveGreaterThanArrival(frm) {
		var ArrivalTime = frm.arrivalTime.value.split(":");
		var LeaveTime = frm.leaveTime.value.split(":");
		var ArrivalHour = parseInt(ArrivalTime[0]);
		var ArrivalMinute = parseInt(ArrivalTime[1]);
		var LeaveHour = parseInt(LeaveTime[0]);
		var LeaveMinute = parseInt(LeaveTime[1]);
		var TotalArrivalTime = ArrivalHour*60+ArrivalMinute;
		var TotalLeaveTime = LeaveHour*60+LeaveMinute;
		if (TotalArrivalTime >= TotalLeaveTime) {
			return false;
		}
		else {
			return true;
		}
	}
	
</script>

</body>
</html>